Fix a crash in gnome-terminal when using a compositor
authorMatthias Clasen <mclasen@redhat.com>
Sat, 13 Nov 2010 00:19:48 +0000 (19:19 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 13 Nov 2010 00:22:49 +0000 (19:22 -0500)
In this case, gnome-terminal sets an RGBA visual on its window,
and we need to be careful when creating the icon pixmap, to create
the pixmap with the same depth as the visual, or we risk a BadMatch
from XRenderCreatePicture deep inside cairo.

gdk/x11/gdkwindow-x11.c

index 9f54ddc3c564760a868aa147ee799482506edd82..88d85101aeaaafc471946aba7a22235b3612ce73 100644 (file)
@@ -278,14 +278,16 @@ gdk_x11_window_create_pixmap_surface (GdkWindow *window,
 {
   cairo_surface_t *surface;
   Pixmap pixmap;
+  GdkVisual *visual;
 
+  visual = gdk_window_get_visual (window);
   pixmap = XCreatePixmap (GDK_WINDOW_XDISPLAY (window),
                           GDK_WINDOW_XID (window),
                           width, height,
-                          DefaultDepthOfScreen (GDK_SCREEN_XSCREEN (GDK_WINDOW_SCREEN (window))));
+                          gdk_visual_get_depth (visual));
   surface = cairo_xlib_surface_create (GDK_WINDOW_XDISPLAY (window),
                                        pixmap,
-                                       GDK_VISUAL_XVISUAL (gdk_window_get_visual (window)),
+                                       GDK_VISUAL_XVISUAL (visual),
                                        width, height);
   attach_free_pixmap_handler (surface, GDK_WINDOW_DISPLAY (window), pixmap);